import { defineStore } from 'pinia';

export const useUserStore = defineStore('user', {
  state: () => {
    return { name: '', isLogin: false };
  },
  // could also be defined as
  // state: () => ({ count: 0 })
  actions: {
    login(name: string) {
      this.name = name;
      this.isLogin = true;
    },
    loginOut() {
      this.name = '';
      this.isLogin = false;
    },
  },
});
